/*
 定义一个函数，用于交换两个整形变量的值
 */
#include <stdio.h>

void change(int a,int b){
	int c;
	c = a;
	a = b;
	b = c;
	printf("a = %d b = %d \n",a,b);
}

void swap(int* pNum1,int* pNum2){
	int temp = *pNum1;
	*pNum1 = *pNum2;
	*pNum2 = temp;
}

int main(){
	int a = 0,b = 0;
	printf("请输入两个数\n");
	scanf("%d%d",&a,&b);
	printf("a = %d b = %d\n",a,b);
	//change(a,b);//值传递
	swap(&a,&b);//址传递
	printf("num1 = %d num2 = %d \n",a,b);
	return 0;
}
